package com.cyh.testdesignpattern.composite;

import android.util.Log;

import java.util.ArrayList;
import java.util.List;

//院系
public class College extends OrganizationComponent{
    //添加的是专业
    List<OrganizationComponent> organizationComponentList = new ArrayList<>();

    public College(String name, String des) {
        super(name, des);
    }

    @Override
    public void print() {
        Log.i("College", "-----" + getName() + "-----");
        for(OrganizationComponent organizationComponent : organizationComponentList) {
            organizationComponent.print();
        }
    }

    @Override
    public void add(OrganizationComponent organizationComponent) {
        organizationComponentList.add(organizationComponent);
    }

    @Override
    public void remove(OrganizationComponent organizationComponent) {
        organizationComponentList.remove(organizationComponent);
    }
}
